Evolution of Object Behavior using

نویسنده

  • Linda M. Seiter
چکیده

CompositeEquipment abstract void visit (Visitor v) void net() {....} void discount() {....} Card void visit (Visitor v) { v.atCard(this); } void visit (Visitor v) Cabinet { v.atCabinet(this); for (int i=0; i<numparts; i++) parts[i].visit(v); } Fig. 6. Composite Equipment Pattern erations to perform during composite-object traversal. A composite is a structural pattern that represents a wholepart hierarchy, and is modeled using the aggregation relation. For example, the class structure in Figure 6 describes a containment hierarchy for computer equipment, which may contain other equipment as parts. The visitor pattern may be used to reduce the number of operations directly embedded within a class, thus preventing class de nitions from becoming cluttered. Visitors group related operations performed on multiple classes (which need not be related through inheritance) together into one program component, supporting a collaborative, task-based style of programming. Collaborative styles have become very popular through such mechanisms as Contracts [10], Subjects [11], and Propagation Patterns [12], [13]. Figure 7 contains a standard visitor design, similar to the example presented by Gamma et al [1]. An example task computes the total cost of computer equipment, based on accumulating the net price of simple equipment (Card, Drive, FloppyDisk) and the discount price of composite equipment (Chassis, Cabinet, Bus). Another task might be to accumulate a list of equipment contained within a computer. Each of these tasks can be implemented with a traversal and a visitor. A traversal implements a generic navigation algorithm, simply accessing each equipment object contained within a composite object by recursively following aggregation relations. The traversal is implemented by de ning a visitmethod in each concrete equipment class. The visit method simply tells the visitor that it has encountered a particular class instance. For example, the visit method for the Card class sends the visitor an atCard message, passing the self reference as an argument. The visit method in the Cabinet class will send an atCabinet message to the visitor as well as traverse the equipment objects reachable through its parts relation. The relation between the Equipment and Visitor classes takes the form of a method invocation. The Visitor class will have a default empty atXXX method for each concrete class XXX. This default behavior may be overridden in subclasses of Visitor to perform a task-speci c behavior. For example, the Pricing visitor will override the default inherited methods to add the net price of simple equipment and the discount price of composite equipment, while the Inventory visitor will override the inherited methods to accumulate a list of equipment. The visitor design points out some of the di culties of supporting dynamic behavior with languages such as Java and C++. The appropriate behavior to execute when an object is encountered during traversal depends on both the type of the object being visited as well as the type of the visitor. The code for the visitor is quite awkward, primarily due to the single dispatch binding mechanism of Java and C++. Although the same behavior is performed by the inventory visitor when either a Card or Chassis object is encountered, the limitation of the single dispatch mechanism still requires an atXXX method to be de ned for each concrete class XXX . Code reuse is not achieved through in-

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Research on Chaos Characteristic of Crack Evolution in Coal-rock Fracturing

Precisely describing the formation and evolution rules of coal-rock fracturing crack have great value on reservoir fracturing improvement and highly efficient mining of coal bed methane well. In this paper, a non-linear dynamic method is used to study crack damage evolution behavior of coal-rock fracturing. Considering distribution characteristics of natural cracks in coal-rock, and based on da...

متن کامل

Application of Combined Local Object Based Features and Cluster Fusion for the Behaviors Recognition and Detection of Abnormal Behaviors

In this paper, we propose a novel framework for behaviors recognition and detection of certain types of abnormal behaviors, capable of achieving high detection rates on a variety of real-life scenes. The new proposed approach here is a combination of the location based methods and the object based ones. First, a novel approach is formulated to use optical flow and binary motion video as the loc...

متن کامل

Availability evaluation of Software architecture of object oriented Style using coloured Petri nets

Software architecture is one of the most fundamental products in the process of software development in the areas of behavioral or non- behavioral features like availability or transformability change. There are different ways to evaluate software architecture one of which is the creation of application model. An executable model of software architecture is an official description of architectu...

متن کامل

Does Core Stability Training Affect Fundamental Movement Skills in Low Proficiency Children? Evaluation of Performance Process

The present study investigated the effects of 8-weeks of core stability training on fundamental movement skills in children with low proficiency in both locomotor and object control skills. By using a semi-experimental research design. 30 elementary boy students (means age= 8.89 years, SD= 1.06) were recruited and organized in training (n= 15) and control group (n=15). Fundamental movement skil...

متن کامل

A Useful Family of Stochastic Processes for Modeling Shape Diffusions

&nbsp;One of the new area of research emerging in the field of statistics is the shape analysis. Shape is defined as all the geometrical information of an object whose location, scale and orientation is not of interest. Diffusion in shape analysis can be studied via either perturbation of the key coordinates identifying the initial object or random evolution of the shape itself. Reviewing the f...

متن کامل

Social life, evolution of intelligence, behaviour and human brain size

Social life is one of the most critical factors of the evolution of the behavior of non-human primates and humans. Several factors, such as an increase in brain size, adaptive modules, and grooming, are related to the complexities of social groups. Although some scientists have mentioned foraging as a rival hypothesis for the evolution of behavior, in this research, we tried to investigate the ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1996